//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.kun.portal.webframe.dao;

import com.kun.portal.webframe.po.FwModulePo;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface FwModuleDao extends JpaRepository<FwModulePo, String>, JpaSpecificationExecutor<FwModulePo> {
    Page<FwModulePo> findByModuleUrlAndModuleNameContaining(String var1, String var2, Pageable var3);

    Page<FwModulePo> findByCreatorAndModuleUrlAndModuleNameContaining(String var1, String var2, String var3, Pageable var4);

    Page<FwModulePo> findByCreatorAndModuleTypeAndModuleNameContainingOrderByModuleCode(String var1, String var2, String var3, Pageable var4);

    List<FwModulePo> findByModuleNameLike(String var1);

    List<FwModulePo> findByCreatorAndModuleTypeAndParentCodeIsNullOrderByModuleId(String var1, String var2);

    List<FwModulePo> findByCreatorAndModuleTypeAndParentCodeEqualsOrderByModuleId(String var1, String var2, String var3);

    @Query(
            nativeQuery = true,
            value = "select * from fw_module where parent_code in(select module_code from fw_module where module_id=?1)"
    )
    List<FwModulePo> findChildrenByModuleId(String var1);

    List<FwModulePo> findByParentCodeOrderByModuleSeq(String var1);

    @Query(
            nativeQuery = true,
            value = "select m.* from fw_module m join fw_role_module rm on rm.module_id = m.module_id  join fw_role r on r.role_status!='0' and r.role_id = rm.role_id and (r.team_id= :teamId or r.team_id is null or r.team_id = '')  join fw_role_user ru on rm.role_id = ru.role_id  where m.module_code like :parentCode  and m.module_status!='0' and ru.user_id = :userId  order by m.parent_code,m.module_seq"
    )
    List<FwModulePo> findPermissionModule(@Param("parentCode") String var1, @Param("teamId") String var2, @Param("userId") String var3);
}
